home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / macros / tip / isprefix.tip < prev    next >
Text File  |  1993-09-15  |  2KB  |  56 lines

  1. % This macro source file is from the four volume series
  2. % "TeX in Practice" by Stephan von Bechtolsheim, published
  3. % 1993 by Springer-Verlag, New York.
  4. % Copyright 1993 Stephan von Bechtolsheim.
  5. % No warranty or liability is assumed.
  6. % This macro may be copied freely if no fees other than
  7. % media cost or shipping charges are charged and as long
  8. % as this copyright and the following source code itself
  9. % is not changed. Please see the series for further information.
  10. %
  11. % Version: 1.0
  12. % Date: May 1, 1993
  13. %
  14. %
  15. % This source code is documented in 24.1.18.1, p. III-302.
  16. % Original source in file "macros4.TEX", starting line 1096.
  17. \wlog{L: "isprefix.tip" ["macros4.TEX," l. 1096, p. III-302]}%
  18. % This file DOES belong to format "texip."
  19. \InputD{compst.tip}
  20. \InputD{strleng.tip}
  21. \InputD{showx.tip}
  22. \catcode`\@ = 11
  23. \newif\if@PrefixResult
  24. \newcount\@LengthPrefixString
  25. \newcount\@LengthMainString
  26. \def\PrefixConditional #1#2{% 
  27.     TT\fi
  28.     \StringLength{#1}%
  29.     \@LengthMainString = \StringLengthResult
  30.     \StringLength{#2}% 
  31.     \@LengthPrefixString = \StringLengthResult
  32.     \ifnum\@LengthMainString < \@LengthPrefixString
  33.         \@PrefixResultfalse
  34.     \else
  35.         \@PrefixConditionalTwo{#1}{#2}% 
  36.     \fi
  37.     \if@PrefixResult
  38. }
  39. \def\@PrefixConditionalTwo #1#2{% 
  40.     \edef\@PrefixBoth{#1#2}% 
  41.     \edef\@PrefixTemp{% 
  42.         \def\noexpand\@TestPrefix ####1#2####2\noexpand\@Del{% 
  43.             \noexpand\if\noexpand\EmptyStringConditional{####1}%
  44.         }% 
  45.     }% 
  46.     \ShowX\@PrefixTemp
  47.     \@PrefixTemp
  48.     \ShowX{\@TestPrefix}%
  49.     \expandafter\@TestPrefix\@PrefixBoth\@Del
  50.         \@PrefixResulttrue
  51.     \else
  52.         \@PrefixResultfalse
  53.     \fi
  54. }
  55. \catcode`\@ = 12
  56.